<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>Line Sweep</title>
	</head>
	<body>

	</body>
</html>
<script type="text/javascript">
	var martrix = [
		[1, 2, 3],
		[4, 5, 6],
		[7, 8, 9]
	]

	function rotate(matrix) {
		const n = matrix.length;
		const matrix_new = new Array(n).fill(0).map(() => new Array(n).fill(0));
		
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				matrix_new[j][n - i - 1] = matrix[i][j];
			}
		}
		console.log('matrix_new',matrix_new)
		// for (let i = 0; i < n; i++) {
		// 	for (let j = 0; j < n; j++) {
		// 		matrix[i][j] = matrix_new[i][j];
		// 	}
		// }
	};
	rotate(martrix)

	// 结果-------------------------------
	// [
	// 	[7, 4, 1],
	// 	[8, 5, 2],
	// 	[9, 6, 3]
	// ]

// -------------------------------------天际线---------------------------




	
	
</script>
